<template>
	<view>
		<div class="common_out" v-for="(item,index) in dataSorce" @click="detls(item)">
			<!-- 状态 -->
			<div class="common_status">
				<div class="common_box">
					{{
						type_function(item.voucherState)
					}}
				</div>
			</div>
			
			<div class="common">
				<div class="common_left">采购类型：</div>
				<div class="common_right">{{item.purchaseTypeName}}</div>
			</div>
			<div class="common">
				<div class="common_left">单据编号：</div>
				<div class="common_right">{{item.voucherCode}}</div>
			</div>
			<div class="common">
				<div class="common_left">单据日期：</div>
				<div class="common_right">{{item.voucherDate}}</div>
			</div>
			<div class="common">
				<div class="common_left">供应商：</div>
				<div class="common_right">{{item.vendorName}}</div>
			</div>
			<div class="common">
				<div class="common_left">总数量：</div>
				<div class="common_right">{{item.totalQuantity}}</div>
			</div>
		</div>
		
	</view>
</template>

<script>

export default {
	props: {
		dataSorce: {
			default: '',
			type: Array
		},
		urlcode: {
			default: '',
			type: String
		}
	},
	data() {
		return {
			
		}
	},
	mounted() {
		
		console.log(this.dataSorce)
		
	},
	methods: {
		detls(val){
			uni.navigateTo({
				url: '/pages/common/index/procure/arrival/purchase-details?id=' + val.id + '&code='+ this.urlcode
			})
		},
		
		type_function(val){
			if(val == -1){
				return '待提交'
			}
			if(val == 0){
				return '待审核'
			}
			if(val == 1){
				return '已审核'
			}
			
			if(val == 2){
				return '已出库'
			}
		}
	}
}	
	
</script>

<style scoped lang="scss">
	.common {
		padding: 5px 0 5px 0;
		display: flex;
		div {
			overflow: hidden;
		}
	}
	.common_out {
		width: 95%;
		margin: auto;
		background-color: #fff;
		box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
		margin-top: 5px;
	}
	.common_left {
		width: 30%;
		padding: 0 0 0 15px;
	}
	.common_right {
		width: 60%;
		padding: 0 0 0 5px;
	}
	.common_status {
		position: absolute;
		right: 0;
		padding: 10px 20px 0 0;
	}
	
	.common_box {
		padding: 0 8px 0 8px;
		background-color: #0098EF;
		color: #fff;
		border-radius: 4px;
	}
</style>
